import time,random, os
from config import *

# TOKEN密钥
KEY="ZGFiMjAAlkC==_C=ODY6NTliMz"
# 令牌过期时间秒
TIMEOUT = 60*60*24

#销售每天可添加客户数
SALE_CUSTOMER_MAX = 500

# 客户字段中文名
CHANGED_COLUMNS = {
    "name":"公司名称",
    "legalperson":"法人", 
    "contacter":"联系人",
    "phone":"电话",
    "area":"地区",
    "address":"地址",
    "saletype":"客户类别",
    "weixin":"微信",
    "src":"来源",
    "status":"状态",
    "amount":"成交金额", 
    "actualcollection":"实际收款", 
    "balance":"尾款金额", 
    "balancecondtion":"尾款条件", 
    "memo":"备注", 
    "trackerid":"跟踪者ID", 
    "trackername":"跟踪者姓名", 
    "id":"我的客户ID",
    "signtype":"签约方式"
}

COMMON_DEPT = "部门"
COMMON_TEAM = "团队"

COMMON_TRUE = "是"
COMMON_FALSE = "否"

#分配类别
CUSTOMER_ASSIGNETYPE_AUTO = "自动"
CUSTOMER_ASSIGNETYPE_MANUAL  = "手动"

#公共客户状态
CUSTOMER_STATUS_FORBIDDEN = "禁用"
CUSTOMER_STATUS_NORMAL= "正常"
CUSTOMER_STATUS_ASSIGNED = "已分配"
CUSTOMER_STATUS_UNASSIGNED = "未分配"
# 公共客户来源
CUSTOMER_SRC_XIANSUO = "线索"
CUSTOMER_SRC_GONGSHANG = "工商"
CUSTOMER_SRC_QUDAO = "渠道"
CUSTOMER_SRC_OTHER = "其他"
# 签约方式
CUSTOMER_SIGNED_SINGNEW = "新签"
CUSTOMER_SIGNED_SINGCONTINUE = "续签"
CUSTOMER_SIGNED_SINGOLD = "转介绍"
#通知状态
NOTIFY_STATUS_PRESSED = "已处理"
NOTIFY_STATUS_UDPRESSED = "未处理"

#通知类型
NOTIFY_TYPE_CUSTOMER_CHANGED = "客户降级"
NOTIFY_TYPE_CUSTOMER_DEAL = "客户已签约"
NOTIFY_TYPE_CUSTOMER_UNTRACK = "客户未跟踪"

# 我的客户分类
SALE_TYPE_A = "A"
SALE_TYPE_B = "B"
SALE_TYPE_C = "C"
SALE_TYPE_NONE = "无"
# 已签约 已流转客户类别设为S
SALE_TYPE_S = "S"

# 微信状态
MYCUSTOMER_WEIXIN_ADDED = "已添加"
MYCUSTOMER_WEIXIN_NONE = "未添加"

# 我的客户状态
MYCUSTOMER_STATUS_FREE = "已释放"
MYCUSTOMER_STATUS_EXPIRE = "已过期"
MYCUSTOMER_STATUS_FORBIDDEN = "禁用"

MYCUSTOMER_STATUS_UNSIGNED = "未签约"
MYCUSTOMER_STATUS_SIGNED  = "已签约"
MYCUSTOMER_STATUS_VISITED= "已面访"
#MYCUSTOMER_STATUS_UNSTRACKED = "未跟踪"
MYCUSTOMER_STATUS_TRACKED= "已跟踪"
MYCUSTOMER_STATUS_TRANSED = "已流转"

MYCUSTOMER_PICK_OUTDATE = "捡漏"

CUSTOMER_TYPE_COMM = "公共客户"

DISCOUT_TYPE_NORMAL = "普通"
DISCOUT_TYPE_FIRST = "首单特惠"


# A类客户逾期天数7
SALE_TYPE_7DAY = 7
# B类客户逾期天数15
SALE_TYPE_15DAY = 15
# C类客户逾期天数30
SALE_TYPE_30DAY = 30
# 无分类客户逾期天数1并且自动动分配客户
SALE_TYPE_1DAY = 1
# 无分类客户逾期4h,并且手动分配客户
SALE_TYPE_4HOUR = 4
# 无分类客户逾期30分钟,并且是手动分配的线索客户
SALE_TYPE_30M = 30
# 跟踪事项
TRACK_DIANHUAN = "电话沟通"
TRACK_MIANFANG = "面访"
TRACK_QIANYUE = "签约"
TRACK_ADD = "新增"
TRACK_EDIT = "修改"
TRACK_QITA = "其他"

# 审核状态
AUDIT_STATUS_WAITE = "待审核"
AUDIT_STATUS_PASSED = "已审核"
AUDIT_STATUS_DONE = "已完成"
AUDIT_STATUS_CANCLE = "已驳回"
AUDIT_STATUS_OVER = "已作废"

# 流转类型
TRANSFORM_TYPE_NORMAL = "正常流转"
TRANSFORM_TYPE_ENDED = "尾款流转"

#抽奖状态 未抽奖、已抽奖
LOTTERY_UNDO =  "未抽奖"
LOTTERY_ING =  "抽奖中"
LOTTERY_DONE =  "已抽奖"
# 代理记账
AGENTKEEPING = "代理记账"
# 考试表考试状态
TESTSTATE_ONGOING = "进行中"

# 供应商状态
SUPPLIER_STATUS_NORMAL = "正常"
SUPPLIER_STATUS_CANCLE = "已废弃"

# 优惠单状态
DISCOUNT_STATUS_USED = "已使用"
DISCOUNT_STATUS_WAITE = "待审核"
DISCOUNT_STATUS_PASSED = "已审核"
DISCOUNT_STATUS_CANCLE = "已作废"

def createUploadFilename(ext):
    """创建上传文件名"""
    fn = time.strftime('%Y%m%d%H%M%S')
    fn = fn + '%d' % random.randint(0, 1000)
    return fn + ext


# 单选
TEST_DANXUAN = "单选"
# 多选
TEST_DUOXUAN = "多选"
# 优惠券
DELFLAG = "作废"
NOTDELFLAG = "未作废"

#工商财税BM
CAISHUIGONGSHANGDEPT = ["工商部","财务部"]
# 抄税 国税小规模
COPY_TAX_NATIONAL_TAX_SMALL_SCALE_QUARTER = ["抄税 小规模季度", "国税 小规模季度"]
# 抄税 清卡
COPY_TAX_NATIONAL_TAX_CLEARN_TAX = ["抄税 小规模季度", "清卡 每月"]
# 代理记账内容
CONTENT_OF_KEEPINGING_AGENT = ["资料收集", "社保、公积金", "抄税 小规模季度", "国税 小规模季度", "个税 每月", "清卡 每月"]
# 代理记账每月需要操作内容
CONTENT_OF_KEEPINGING_AGENT_EVERY_MONTH = ["资料收集", "社保、公积金", "个税 每月", "清卡 每月"]
# 代理记账状态
KEEPINGING_AGENT_STATUS_SUCCESS = "已完成"
KEEPINGING_AGENT_STATUS_FAIL = "未完成"

# 用户表状态
USER_STATUS_LEAVE = "离职"
USER_STATUS_ON = "在职"

COMMON_GROUP = "分组"
